package cn.xdd._03ack;

import cn.xdd.utils.RabbitMqUtils;
import com.rabbitmq.client.Channel;

import java.util.Scanner;

/**
 * @author user_xdd
 * @Date 2022-05-10 20:25
 * @description
 * @return
 */
public class Producter {
    public static final String ACK_QUEUE_NAME="ack_queue";

    public static void main(String[] args) throws  Exception{
        Channel channel = RabbitMqUtils.getChannel();

        channel.queueDeclare(ACK_QUEUE_NAME,false,false,false,null);
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()){
            String next = scanner.next();
            channel.basicPublish("",ACK_QUEUE_NAME,null,next.getBytes("UTF-8"));
            System.out.println("生产者发送了："+next);
        }


    }
}
